package com.shop.role.service.impl;

import com.shop.role.dao.RoleMapper;
import com.shop.role.entyiy.Role;
import com.shop.role.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    /**
     * 添加角色
     * @param role  角色类
     * @return
     */
    @Override
    public boolean insertRole(Role role) {
        Integer integer = roleMapper.insertRole(role);
        if (integer>0){
            return  true;
        }
        return false;
    }

    /**
     * 删除角色
     * @param role  角色类
     * @return
     */
    @Override
    public boolean deleteRole(Role role) {
        Integer integer = roleMapper.deleteRole(role);
        if (integer>0){
            return true;
        }
        return false;
    }

    /**
     * 修改
     * @param role 角色类
     * @return
     */
    @Override
    public boolean updateRole(Role role) {
        Integer integer = roleMapper.updateRole(role);
        if (integer>0){
            return true;
        }
        return false;
    }

    /**
     *
     * @param roleName 角色名称
     * @return
     */
    @Override
    public List<Role> selectRole(String roleName) {
        return roleMapper.selectRole(roleName);
    }
}
